<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="con">
        <img src="./images/animal1.png" id="img1" />
    </div>
</body>
<script>
    /**
        document是对整个网页文档的抽象，
        document.getElementById("con")
        表示在整个网页文档中，根据元素的ID属性值
        获取到该元素的DOM节点对象
    */
    var con = document.getElementById("con");
    var img1 = document.getElementById("img1");
    img1.onclick = function(){
        /**
         * 在事件的回调函数中
         * this指向当前触发事件的DOM节点对象
        */
        this.style.border = "1px solid red";
    }
</script>
</html>